*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		FIGURES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"
		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/
						
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** FIGURE A11
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	

use data/processed/data_1, clear 
keep if control_pure==1 |control_fincrisis==1 | control_dotcom==1 | control_black==1 
gen h_constrained=(constrained>3)
gen h_age=(age>48)

global controls 		ln_hhnetinc  ///
						ln_ofinwealth_lvl ln_retirewealth_lvl  ///
						ln_realestate_lvl realestJan20_NR		///
						ln_debt_lvl  debtJan20_NR ///
						stockinvestor riskshare_finwealth_Jan201 stockexperience ///
						i.agecat male married separated_divorced widowed ///	
						highschool some_college_associate_degree atleast_bachelor  ///
						mainearner_alone z_constrained self_empl retired unempl empl_other ///
						republican other_party NR_party  ///
						z_decisionmaker  ///
						i.region i.svydate i.treatment  	
					
					
foreach x in del_spend20_usd_tr02 delhhnetinc_USD_tr02_qtr delhhnetinc_USD_tr02alt_qtr delretir_USD_tr02 delfinwealth_USD_tr02alt delretir_USD_tr02alt delofin_USD_tr02alt	delofin_USD_tr02 delhhnetinc_USD_tr02 delfinwealth_USD_tr02 {
		replace `x' = `x'/1000
}		
foreach var of varlist expec_debthigher expec_morehrs expec_retirlater{
	gen `var'_00=100* `var' 
}

			
** debt 
			binscatter 	expec_debthigher_00 /// 
						del_retir_perc_tr02 ///
						, line(lfit) controls(del_ofin_perc_tr02 del_hhnetinc_perc_tr02 $controls) ///
						ylabel(, nogrid) ///
						ytitle("Debt", size(medsmall)) ///
						xtitle("Change in retirement wealth (%)", size(medsmall))  ///						
						saving(Figures/bin1, replace) reportreg
			binscatter 	expec_debthigher_00 /// 
						 del_ofin_perc_tr02 ///
						, line(lfit) controls( del_retir_perc_tr02 del_hhnetinc_perc_tr02 $controls) ///
						ylabel(, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in other fin. wealth (%)", size(medsmall))  ///	
						saving(Figures/bin2, replace) reportreg
			binscatter 	expec_debthigher_00 /// 
						 del_hhnetinc_perc_tr02 ///
						, line(lfit) controls(del_ofin_perc_tr02 del_retir_perc_tr02  $controls) ///
						ylabel(, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in income (%)", size(medsmall))  ///	
						saving(Figures/bin3, replace) reportreg 
				
** hours 
			binscatter 	expec_morehrs_00 /// 
						del_retir_perc_tr02 ///
						, line(lfit) controls(del_ofin_perc_tr02 del_hhnetinc_perc_tr02 $controls) ///
						ylabel(, nogrid) ///
						ytitle("Desired hours", size(medsmall)) ///
						xtitle("Change in retirement wealth (%)", size(medsmall))  ///						
						saving(Figures/bin4, replace) reportreg
			binscatter 	expec_morehrs_00 /// 
						 del_ofin_perc_tr02 ///
						, line(lfit) controls( del_retir_perc_tr02 del_hhnetinc_perc_tr02 $controls) ///
						ylabel(, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in other fin. wealth (%)", size(medsmall))  ///	
						saving(Figures/bin5, replace) reportreg
			binscatter 	expec_morehrs_00 /// 
						 del_hhnetinc_perc_tr02 ///
						, line(lfit) controls(del_ofin_perc_tr02 del_retir_perc_tr02  $controls) ///
						ylabel(, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in income (%)", size(medsmall))  ///	
						saving(Figures/bin6, replace) reportreg
				
** retire 
			binscatter 	expec_retirlater_00 /// 
						del_retir_perc_tr02 ///
						, line(lfit) controls(del_ofin_perc_tr02 del_hhnetinc_perc_tr02 $controls) ///
						ylabel(, nogrid) ///
						ytitle("Retirement age", size(medsmall)) ///
						xtitle("Change in retirement wealth (%)", size(medsmall))  ///						
						saving(Figures/bin7, replace) reportreg
			binscatter 	expec_retirlater_00 /// 
						 del_ofin_perc_tr02 ///
						, line(lfit) controls( del_retir_perc_tr02 del_hhnetinc_perc_tr02 $controls) ///
						ylabel(, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in other fin. wealth (%)", size(medsmall))  ///	
						saving(Figures/bin8, replace) reportreg
			binscatter 	expec_retirlater_00 /// 
						 del_hhnetinc_perc_tr02 ///
						, line(lfit) controls(del_ofin_perc_tr02 del_retir_perc_tr02  $controls) ///
						ylabel(, nogrid) ///
						ytitle("", size(medsmall)) ///
						xtitle("Change in income (%)", size(medsmall))  ///	
						saving(Figures/bin9, replace) reportreg
			
			
			graph combine Figures/bin1.gph ///	
						  Figures/bin2.gph ///
						  Figures/bin3.gph, ///
			b1title("", size(small)) ycommon  ///
			cols(3) rows(1) xsize(3) ysize(1) saving(Figures/top, replace) 
				
				
			graph combine Figures/bin4.gph ///	
						  Figures/bin5.gph ///
						  Figures/bin6.gph, ///
			b1title("", size(small)) ycommon ///
			cols(3) rows(1) xsize(3) ysize(1) saving(Figures/mid, replace)
				
					
			graph combine Figures/bin7.gph ///	
						  Figures/bin8.gph ///
						  Figures/bin9.gph, ///
			b1title("", size(small)) ycommon ///
			cols(3) rows(1) xsize(3) ysize(1) saving(Figures/bot, replace)
				
			
			graph combine Figures/top.gph ///	
						  Figures/mid.gph ///
						  Figures/bot.gph, ///
				l1title("Increase expected... (%)", size(vsmall))  iscale(.62) cols(1) rows(3) xsize(3) ysize(3) 
					
				
			graph export Figures/FigureA11.pdf, as(pdf) fontface("cmr10") replace	
			graph export Figures/FigureA11.png,  width(1600) replace		
			

	forvalues x = 1/9 {
			capture erase Figures/bin`x'.gph
	}		
	
	capture erase Figures/top.gph
	capture erase Figures/mid.gph
	capture erase Figures/bot.gph
					
